package msr.frontend;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import msr.object.Yoyaku;
import msr.service.OracleService;
import msr.util.RequestAction;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class YoyakulistController extends ActionSupport {
	private List<Yoyaku> rtListYoyaku;
	private OracleService oService = new OracleService();
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	Map<String, Object> session = ActionContext.getContext().getSession();
	private String username;
	private String passwd;

	public String execute() {
		this.setUsername((String) session.get("username"));
		this.setPasswd((String) session.get("passwd"));
		// get list yoyaku
		Map<String, String> params = new HashMap<String, String>();
		// add params from client into params variable
		rtListYoyaku = oService.getListYoyaku(params,
				RequestAction.GET_ALL_YOYAKU);
		if (rtListYoyaku == null) {
			addActionError(getText("error.getListDplnNotDeleveryYet"));
			return ERROR;
		} else
			return SUCCESS;
	}

	public List<Yoyaku> getRtListYoyaku() {
		return rtListYoyaku;
	}

	public void setRtListYoyaku(List<Yoyaku> rtListYoyaku) {
		this.rtListYoyaku = rtListYoyaku;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPasswd() {
		return passwd;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}

}
